@import '../../style/_variables.less';
@import '../../style/global.less';

.mooli-dialog {
  position: fixed;
  top: 45%;
  left: 50%;
  width: @dialog-width;
  overflow: hidden;
  font-size: @dialog-font-size;
  background-color: @dialog-background-color;
  border-radius: @dialog-border-radius;
  transform: translate3d(-50%, -50%, 0);
  backface-visibility: hidden;
  transition: 5s;
  transition: @dialog-transition;
  transition-property: transform, opacity;
  z-index: @overlay-z-index;

  @media (max-width: 321px) {
    width: @dialog-small-screen-width;
  }

  &--header {
    padding-top: @dialog-header-padding-top;
    font-weight: @dialog-header-font-weight;
    line-height: @dialog-header-line-height;
    text-align: center;

    &--isolated {
      padding: @dialog-header-isolated-padding;
    }
  }

  &--content {
    &--isolated {
      display: flex;
      align-items: center;
      min-height: 104px;
    }
  }

  &--message {
    flex: 1;
    max-height: @dialog-message-max-height;
    padding: 26px @dialog-message-padding;
    overflow-y: auto;
    font-size: @dialog-message-font-size;
    line-height: @dialog-message-line-height;

    // allow newline charactor
    white-space: pre-wrap;
    text-align: center;
    word-wrap: break-word;
    -webkit-overflow-scrolling: touch;

    &--has-title {
      padding-top: @dialog-has-title-message-padding-top;
      color: @dialog-has-title-message-text-color;
    }

    &--left {
      text-align: left;
    }

    &--right {
      text-align: right;
    }
  }

  &--footer {
    display: flex;
    overflow: hidden;
    user-select: none;
    &--vertical {
      display: block;
    }
  }

  &--confirm,
  &--cancel {
    flex: 1;
    height: @dialog-button-height;
    margin: 0;
    border: 0;

    &--loading {
      .mooli-loading {
        color: #ee0a24;
      }

      .mooli-loading--text {
        display: none;
      }
    }
  }

  &--confirm {
    &,
    &:active {
      color: @dialog-confirm-button-text-color;
    }
  }

  &--round-button {
    .mooli-dialog--footer {
      position: relative;
      height: auto;
      padding: @padding-xs @padding-lg @padding-md;
    }

    .mooli-dialog--message {
      padding-bottom: @padding-md;
      color: @text-color;
    }

    .mooli-dialog--confirm,
    .mooli-dialog--cancel {
      height: @dialog-round-button-height;
    }

    .mooli-dialog--confirm {
      color: @white;
    }
  }

  &--scale {
    &-enter,
    &-appear,
    &-exit-done {
      transform: translate3d(-50%, -50%, 0) scale(0.7);
    }

    &-appear-active,
    &-enter-active {
      transform: translate3d(-50%, -50%, 0) scale(1);
    }

    &-enter-done,
    &-exit {
      opacity: 1;
      transform: translate3d(-50%, -50%, 0) scale(1);
    }

    &-exit-active {
      opacity: 0;
      transform: translate3d(-50%, -50%, 0) scale(0.9);
    }
  }
}
